package cn.azzhu.springdemo.controller;

import cn.azzhu.springdemo.service.PhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author azzhu
 * @create 2020-08-22 14:37:31
 */
@RestController
public class PhoneController {

    @Autowired
    private PhoneService phoneService;

    @GetMapping("getById/{id}")
    public Object getById(@PathVariable("id") Integer id) {
        return phoneService.getById(id);
    }

    @GetMapping("getPage")
    public Object getPage(@RequestParam(value = "pageNum",required = false,defaultValue = "1") Integer pageNum,
                          @RequestParam(value = "pageSize",required = false,defaultValue = "2") Integer pageSize) {
        return phoneService.getPage(pageNum,pageSize);
    }
}
